package com.thirteen.app.controller;

import com.thirteen.app.service.LogsService;
import com.thirteen.app.utils.tools.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.oas.annotations.EnableOpenApi;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 日志表(Logs)表控制层
 *
 * @author makejava
 * @since 2021-09-09 15:02:10
 */
@Api
@EnableOpenApi
@CrossOrigin
@RestController
@RequestMapping("/api/admin/logs")
public class LogsController {
    /**
     * 服务对象
     */
    @Resource
    private LogsService logsService;

    @ApiOperation(value = "分页查询日志信息")
    @GetMapping("/page")
    private CommonResult listPageCourse(Integer pageIndex, Integer pageSize) {
        Map<String, Object> map = new HashMap<>();
        map.put("data", logsService.queryAllByLimit(pageIndex, pageSize));
        map.put("total", logsService.getLogsCount());
        //map.put("total",courseService.getCourseCount(subject,academy));
        return CommonResult.success(map);
    }

}
